package com.blood.modules.pregnancy.controller;

import com.blood.core.resp.ResponseResult;
import com.blood.modules.pregnancy.dto.req.PregnancyHomeReq;
import com.blood.modules.pregnancy.dto.resp.PregnancyGatherDataResp;
import com.blood.modules.pregnancy.dto.resp.PregnancyHomeInfoResp;
import com.blood.modules.pregnancy.dto.resp.PregnancyHomeMessageResp;
import com.blood.modules.pregnancy.service.IPregnancyHomeService;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 孕产主页Controller
 *
 * @author daoren
 * @date 2022-11-25 09:11:14
 */
@Api(value = "孕产主页", tags = "孕产主页")
@ApiSort(900)
@RestController
@RequestMapping("/pregnancy/home")
public class PregnancyHomeController {

    /**
     * 孕产用户服务.
     */
    @Autowired
    private IPregnancyHomeService pregnancyHomeService;

    /**
     * 通知按钮
     *
     * @return 消息数据
     */
    @GetMapping("/messageInfo")
    @ApiOperation(value = "通知按钮")
    public ResponseResult<PregnancyHomeMessageResp> messageInfo() {
        return pregnancyHomeService.homeMessageInfo();
    }

    /**
     * 普通用户首页查询.
     *
     * @return 主页数据
     */
    @ApiOperation(value = "普通用户首页查询")
    @GetMapping(value = "/query")
    public ResponseResult<PregnancyHomeInfoResp> query() {
        return pregnancyHomeService.gatherUserInfoQuery();
    }

    /**
     * 获取统计数据.
     *
     * @return 统计数据
     */
    @ApiOperation(value = "获取统计数据")
    @PostMapping(value = "/getStatisticsData")
    public ResponseResult<PregnancyGatherDataResp> getStatisticsData(@RequestBody @Validated PregnancyHomeReq req) {

        return pregnancyHomeService.getStatisticsData(req.getStatisticsDate());
    }

    /**
     * 管理员首页查询.
     *
     * @return 修改结果
     */
    @ApiOperation(value = "管理员首页查询")
    @GetMapping(value = "/adminQuery")
    public ResponseResult<Void> adminQuery() {
        return null;
    }

}
